package cn.nnxy.zentao.service.impl;

import cn.nnxy.zentao.domain.ZPublish;
import cn.nnxy.zentao.mapper.ZPublishMapper;
import cn.nnxy.zentao.service.PublishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PublishServiceImpl implements PublishService {
    @Autowired
    ZPublishMapper publishMapper;

    @Override
    public List<ZPublish> queryList() {
        return publishMapper.selectList();
    }

    @Override
    public ZPublish seletById(Integer id) {
        if (null == id){
            return null;
        }
        return publishMapper.selectById(id);
    }

    @Override
    public int savePublish(ZPublish publish) {
        if (null == publish){
            return 0;
        }
        return publishMapper.insert(publish);
    }

    @Override
    public int updateById(ZPublish publish) {
        if (null == publish || publish.getPubId() == null){
            return 0;
        }
        return publishMapper.updateById(publish);
    }

    @Override
    public int deleteById(Integer ids) {
        if (null == ids){
            return 0;
        }
        return publishMapper.deleteById(ids);
    }
}
